boundingClientRectInViewport

Returns the rectangle bounds of the element and its position relative to the top-left of the viewport of the main document.

This method can return an empty Rect in the following cases:

  • the element is not attached to the DOM tree;
  • the element is not visible and has the hidden attribute;
  • the CSS style of the element contains display: none; statement.

If the element is attached to the DOM tree and is visible, but it is out of the viewport, this method still returns its bounds.

To get the bounding rectangle of the element relative to the viewport of the current document, use the boundingClientRect method.

The origin and size of the returned rectangle are in the device-independent pixels.

Since

8.8.0

Throws

when this instance is closed